import merge from 'webpack-merge';
import webpack from 'webpack';

import { getCommonWebpackConfig } from './webpack.common';
import { UnionWebpackConfigWithDevelopmentServer } from '../types';
import { WebpackConfig } from '../constants';

function getProductionWebpackConfig(): UnionWebpackConfigWithDevelopmentServer {
    const commonConfig = getCommonWebpackConfig(false);

    return merge(commonConfig, {
        // devtool: 'none',
        mode: 'production',
        plugins: [
            ...WebpackConfig.fixedPlugins,
            new webpack.BannerPlugin({
                raw: true,
                /** @preserve Powered by react-ts-quick-starter (https://github.com/vortesnail/react-ts-quick-starter) */
                banner: '/** @preserve Powered by qing qiu du */',
            }),
        ],
    });
}

export default getProductionWebpackConfig();
